package ob_TakeNote.utils;

import java.io.File;
import java.util.List;

/**
 * 代码实现功能，就是给出 String="目录/"，String:文件名字
 * 输出：String="目录/文件名字"
 */
public class SplicingAddress {
    public List<File> splicingAddress(String newFileAddress, List<File> matchingPaths  )

    {
           List<File> newPaths = new java.util.ArrayList<>();
           for (File file : matchingPaths) {
               String fileName = file.getName();
               String newAddress = newFileAddress + fileName;
               File newFile = new File(newAddress);
               newPaths.add(newFile);
           }



        return newPaths;
    }
    public static File splicingAddress(String newFileAddress, File matchingPaths ){

//        int lastBackslashIndex = matchingPaths.lastIndexOf('\\');
//        String fileName =matchingPaths.substring(lastBackslashIndex + 1);
          String fileName = matchingPaths.getName();
        return  new File(newFileAddress + fileName);
    }

}

